feat: add integration tests for WIP's transferFrom and approve methods#106
Merged
lucas2brh merged 6 commits intostoryprotocol:mainfrom Sep 5, 2025
Merged
feat: add integration tests for WIP's transferFrom and approve methods#106lucas2brh merged 6 commits intostoryprotocol:mainfrom
lucas2brh merged 6 commits intostoryprotocol:mainfrom
Conversation
- Add the 3rd test wallet to be the receiver - Add comprehensive test coverage for WIP token approval functionality - Add integration tests for transferFrom with various scenarios (basic, insufficient allowance, insufficient balance, invalid inputs) - Fix import issue with wallet_address_3 in setup_for_integration.py
chore chore
049c1f4 to
5bac040
Compare
bonnie57
reviewed
Sep 5, 2025
| return {"tx_hash": response["tx_hash"]} | ||
|
|
||
| except Exception as e: | ||
| raise ValueError(f"Failed to withdraw WIP: {str(e)}") |
Contributor
There was a problem hiding this comment.
Why need to remove the prefix? The prefix can give a detail on which method fails.
| if sender_wip_before < transfer_amount: | ||
| story_client.WIP.deposit( | ||
| amount=transfer_amount - sender_wip_before, | ||
| tx_options={"waitForTransaction": True}, |
Contributor
There was a problem hiding this comment.
Python SDK doesn't have an option for waitForTransaction.
| with pytest.raises(Exception) as exc_info: | ||
| story_client.WIP.transfer( | ||
| to=contract_address, | ||
| amount=web3.to_wei("0.01", "ether"), |
Contributor
There was a problem hiding this comment.
It's a large amount, could we consider a small amount? Because it will spend many native token when it run.
Contributor
There was a problem hiding this comment.
web3.to_wei("0.01", "ether") =1 wei
| pass | ||
|
|
||
| def teardown_method(self): | ||
| """Teardown method called after each test""" |
Contributor
There was a problem hiding this comment.
Could we use fixture instead of setup_method and teardown_method methods?
lucas2brh
commented
Sep 5, 2025
lucas2brh
commented
Sep 5, 2025
lucas2brh
commented
Sep 5, 2025
lucas2brh
commented
Sep 5, 2025
lucas2brh
commented
Sep 5, 2025
bonnie57
approved these changes
Sep 5, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Test
All tests passed on my MAC.
Related Issue
Close #83